
function httpReq(obj = {}){
  wx.showLoading({
    title: '拼命加载中……',
  })
    let url = obj.url || '';
    let data = obj.data || {};
    let method = obj.method || 'GET';
    return new Promise((s,e)=>{
      wx.hideLoading({});
      wx: wx.request({
        url,
        method,
        data,
        dataType: 'json',
        responseType: 'text',
        success: s,
        fail: e,
      })
    });
}

//提示框函数
function tipmsg(type){
  wx.showModal({
    title: '提示消息',
    content: '需要登录后才能'+ type +'哦',
    showCancle: true,
    cancelText: '算了',
    confirmText:'去登陆',
    confirmColor: '#00dd00',
    success:(re)=>{
      if(re.confirm){
        wx.switchTab({
          url:'/pages/home/home'
        })
      }else{
        return false;
      }
    }
  })
}




export {httpReq};
export {tipmsg};
